package com.platform.modular.controller;

import com.platform.common.model.Result;
import com.platform.modular.feign.activity.ActivityFeignService;
import com.platform.modular.model.activity.ActivityBaseVO;
import com.platform.modular.model.activity.ActivityListDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author yifei.han
 * @version 1.0
 * @className ActivityController
 * @description 小程序活动控制层
 * @date 2022/3/18
 */
@Slf4j
@RestController
@RequestMapping("miniprogram/activity")
public class ActivityController {

    @Autowired
    private ActivityFeignService activityFeignService;

    /**
     * 活动列表
     * @param activityListDTO
     * @return
     */
    @RequestMapping(value = "/activityList")
    public Result activityList(ActivityListDTO activityListDTO) {
        List<ActivityBaseVO> activityList = activityFeignService.obtainActivityBaseList(activityListDTO);
        return Result.ok().setResult(activityList);
    }

    /**
     * 活动详情
     * @param activityId
     * @return
     */
    @RequestMapping(value = "/activityDetail")
    public Result activityDetail(@RequestBody Long activityId) {
        ActivityBaseVO activityDetail = activityFeignService.obtainActivityDetail(activityId);
        return Result.ok().setResult(activityDetail);
    }


}
